// editableList.module.scss
.container{
  margin-bottom: 40px;
}
.listContainer {
  display: flex;
  flex-direction: column;
  gap: 4px;
  // max-width: 460px;
  // margin: 20px auto;
  position: relative;
  padding-left: 16px;
}

.item {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 9px 16px;
  position: relative;
  transition: background-color 0.2s ease;

  &::before {
    // 小圆点本身
    content: "";
    position: absolute;
    left: -13px;
    top: 50%;
    transform: translateY(-50%);
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background-color: #353535;
    z-index: 1;


    :global(.dark) & {
      background-color: #BDBDBD;
    }
  }

  &::after {
    // 小圆点下连线
    content: "";
    position: absolute;
    left: -10px;
    top: 50%;
    bottom: -50%;
    width: 1px;
    background-color: #E5E5E5;
    z-index: 0;

    :global(.dark) & {
      background-color: #353535;
    }
  }

  // 关键：拖动时隐藏下连线（黑点保留）
  &.dragging::after {
    display: none;
  }

  &:last-child::after {
    content: none; // 最后一项不显示下连线
  }

  &:hover {
    .deleteButton {
      display: flex;
    }
  }

  &.loading {
    opacity: 0.9;
    
    .tag {
      position: relative;
      color: transparent;
      background: #F5F5F5;
      box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
      
      :global(.dark) & {
        background: #2A2A2D;
        box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
      }
      
      &::after {
        content: '';
        position: absolute;
        width: 14px;
        height: 14px;
        border: 2px solid transparent;
        border-top-color: #666666;
        border-right-color: #666666;
        border-radius: 50%;
        left: 50%;
        top: 50%;
        margin-left: -7px;
        margin-top: -7px;
        animation: spinner 0.8s cubic-bezier(0.5, 0.1, 0.5, 0.9) infinite;
      }
    }
    
    :global(.dark) & .tag::after {
      border-top-color: #A1A1AA;
      border-right-color: #A1A1AA;
    }
  }
  
  &.completed {
    .tag {
      background: #F0F9F0;
      color: #2E7D32;
      
      :global(.dark) & {
        background: #1B2E1B;
        color: #81C784;
      }
    }
  }
  
  &.disabled {
    // opacity: 0.6;
    // cursor: not-allowed;
    
    .labelAndDelBtn {
      pointer-events: none;
      
      &:hover {
        background-color: transparent;
      }
    }
  }
}

.tag {
  color: #353535;
  font-size: 12px;
  font-weight: 500;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 6px;
  user-select: none;
  width: 32px;
  height: 32px;
  background: #E9E9E9;
  border-radius: 8px;
  position: relative; /* Ensure position relative for absolute positioning */
  margin-right: 10px;

  :global(.dark) & {
    background: #DEDEDE;
  }
}

.labelAndDelBtn {
  flex: 1;
  display: flex;
  line-height: 32px;
  height: 32px;
  border-radius: 8px;
  color: #353535;

  min-width: 0; // ✅ 必加，允许 .label 触发省略

  &:hover {
    background-color: #F3F3F3;
  }

  :global(.dark) & {
    &:hover {
      background: #2E3033;
    }

    color:#BDBDBD;
  }
}

.label {
  flex: 1;
  font-size: 14px;
  padding-left: 10px;
  cursor: pointer;
  outline: none;

  // ✅ 文本省略配置
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;

}

.input {
  flex: 1;
  // padding: 4px 8px;
  height: 32px;
  padding-left: 8px;
  font-size: 14px;
  border: 1px solid #ccc;
  border-radius: 8px;

  :global(.dark) & {
    border: 1px solid #3F4245;
    background: none;
    color: #DEDEDE;

    &:focus {
      border-color: #3F4245;
    }
  }
}

.deleteButton {
  margin-right: 16px;
  display: none;
  border: none;
  background: none;
  cursor: pointer;
  // color: #c00;
  align-items: center;
  justify-content: center;
  padding: 4px;
  border-radius: 4px;

  // &:hover {
  //   background-color: #ffefef;
  // }
}

.buttonContainer {
  display: flex;
  gap: 12px;
  margin-top: 13px;
  justify-content: flex-start;
  margin-left: 31px;
}

.addButtonContainer {
  position: relative;
  height: 0;
  display: flex;
  justify-content: flex-start;
}

.addIconBtn {
  all: unset;
  position: absolute;
  // bottom: -16px;
  // left: -12px;
  left: -7px;
  width: 24px;
  height: 24px;
  border-radius: 4px;
  background: #FFFFFF;
  border: 1px solid #E6E6E6;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s ease;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
  z-index: 10;
  top: 16px;

  &::after {
    // 小圆点下连线
    content: "";
    position: absolute;
    left: 12px;
    top: -39px;
    bottom: -50%;
    width: 1px;
    background-color: #E5E5E5;
    z-index: 0;
    height: 40px;

    :global(.dark) & {
      background-color: #353535;
    }
  }
  
  &:hover {
    background-color: #F5F5F5;
    transform: scale(1.1);
  }
  
  svg {
    width: 14px;
    height: 14px;
    color: #333333;
  }
  
  :global(.dark) & {
    background-color: #313234;
    border: 1px solid #3F3F46;
    
    svg {
      color: #E4E4E7;
    }
    
    &:hover {
      background-color: #3F4043;
    }
  }
}

.addBtn {
  all: unset;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 12px;
  height: 30px;
  font-size: 14px;
  color: #333333;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s ease;
  background: #FFFFFF;
  border: 1px solid #E6E6E6;
  min-width: 110px;
  justify-content: center;
  font-weight: 500;
  line-height: 1;
  
  i {
    font-size: 16px;
  }

  span {
    margin-right: 5px;
    vertical-align: middle;
    font-size: 14px;
  }

  &:hover {
    background-color: #F5F5F5;
    border-color: #D1D1D1;
  }
  
  &.loading {
    position: relative;
    pointer-events: none;
    color: transparent;
    background: #F5F5F5;
    border-color: #E0E0E0;
    
    &::after {
      content: '';
      position: absolute;
      width: 16px;
      height: 16px;
      border: 2px solid transparent;
      border-top-color: #666666;
      border-right-color: #666666;
      border-radius: 50%;
      left: 50%;
      top: 50%;
      margin-left: -8px;
      margin-top: -8px;
      animation: spinner 0.8s cubic-bezier(0.5, 0.1, 0.5, 0.9) infinite;
    }
    
    :global(.dark) & {
      background: #2A2A2D;
      border-color: #3F3F46;
      
      &::after {
        border-top-color: #A1A1AA;
        border-right-color: #A1A1AA;
      }
    }
  }
  
  &.completed {
    background-color: #F0F9F0;
    border-color: #C8E6C9;
    color: #2E7D32;
    
    i.checkmark {
      font-size: 14px;
      margin-right: 4px;
    }
  }
  
  :global(.dark) & {
    color: #E4E4E7;
    background-color: #313234;
    border: 1px solid #3F3F46;

    &:hover {
      background-color: #3F4043;
      border-color: #52525B;
    }
    
    &.loading::after {
      border: 2px solid #3F3F46;
      border-top-color: #E4E4E7;
    }
    
    &.completed {
      background-color: #1B2E1B;
      border-color: #2E3B2E;
      color: #81C784;
    }
  }
}

@keyframes spinner {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}


.motion{
  width: 100%;
  display: flex;
}